<template>
	<page-body>
		<view class="page">
			<view
				class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex confiass_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-stretch justify-between confiass_fd0_0'>
					<view class='flex flex-wrap align-center confiass_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  confiass_fd0_0_c0_c0'>&#xe794;</text>
					</view>
					<view class='flex flex-wrap align-center'>
					</view>
					<view class='flex align-center justify-end confiass_fd0_0_c2'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

			<view class="flex flex-direction flex-wrap align-center benben-flex-layout">
				<view class='flex flex-wrap align-center confiass_fd1_0'>
					<text class='confiass_fd1_0_c0'>1</text>
					<view class='flex flex-wrap align-center confiass_fd1_0_c1'>
					</view>
					<text class='confiass_fd1_0_c0'>2</text>
					<view class='flex flex-wrap align-center confiass_fd1_0_c1'>
					</view>
					<text class='confiass_fd1_0_c0'>3</text>
				</view>
				<text class='confiass_fd1_1'>设置支付密码</text>
				<text class='confiass_fd1_2'>请再次输入新支付密码</text>
				<benben-digital-password :box-num='6' mode='password'
					class-name='flex flex align-center justify-center confiass_fd1_3' @confirm="checkPasswordFunc()"
					v-model="pwd" :init-open.sync="xianshi">
					<template #default="{ content, active, index }">
						<view :key="index" v-if="active"
							class="flex align-center justify-center active-digital-password confiass_flex_password_active_fd1_3">
							{{ content }}
						</view>
						<view :key="index" v-else
							class="flex align-center justify-center confiass_flex_password_noActive_fd1_3">
							{{ content }}
						</view>
					</template>
				</benben-digital-password>
				<view class='flex flex-wrap align-center confiass_fd1_4'>
					<text class='confiass_fd1_4_c0'>支付密码为6位数字，用户提现、设置密保、添加银行卡等 操作，可保障资金安全</text>
				</view>
			</view>




		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"pwdCode": "",
				"pwd": "",
				"xianshi": true,
				"type": "1",
				"newPwd": "111111a",
				"oldPwd": "123456a"
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			let {
				type,
				newPwd,
				oldPwd
			} = options
			if (type !== undefined) this.type = type
			if (newPwd !== undefined) this.newPwd = newPwd
			if (oldPwd !== undefined) this.oldPwd = oldPwd
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//校验支付密码
			async checkPasswordFunc() {
				if (!(this.pwd == this.newPwd)) {
					this.$message.info('新密码两次输入不一致');
					return false;
				}
				//请求方法
				//数据验证
				let url = ''
				let page = {}
				if(this.type){
					url = global.apiUrls.post5f69e0271835d
					page.set_pay_password = this.oldPwd
				}else{
					url = global.apiUrls.post5f69dfd20a8c5
					page = {
						pay_password: this.oldPwd,
						new_pay_password: this.newPwd,
						type: this.type
					}
				}
				let data5f69dfd20a8c5 = await this.$api.post(url,page);

					this.$message.info(data5f69dfd20a8c5.data.msg);
				if (data5f69dfd20a8c5.data.code != 1) {
					return
				}
				let info5f69dfd20a8c5 = data5f69dfd20a8c5.data;
				
				setTimeout(() => {
					this.$urouter.navigateBack(3);
				}, 800)
				// this.$message.info('修改成功');
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto;
	}

	.confiass_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.confiass_fd0_0_c2 {
		padding: 0rpx 0rpx 0rpx 0rpx;
		width: 100rpx;
	}

	.confiass_fd0_0_c0_c0 {
		font-size: 36rpx;
		font-weight: 400;
		color: #333;
	}

	.confiass_fd0_0_c0 {
		width: 100rpx;
	}

	.confiass_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.confiass_fd1_4_c0 {
		text-align: center;
		padding: 0rpx 32rpx 0rpx 32rpx;
		font-size: 24rpx;
		color: var(--benbenFontColor2);
	}

	.confiass_fd1_4 {
		margin: 10rpx 0rpx 0rpx 0rpx;
	}

	.confiass_flex_password_noActive_fd1_3 {
		border: 1px solid #ccc;
		width: 100rpx;
		height: 100rpx;
	}

	.confiass_flex_password_active_fd1_3 {
		border: 1px solid #409EFF;
		width: 100rpx;
		height: 100rpx;
	}

	::v-deep .confiass_fd1_3 {
		width: 750rpx;
		height: 160rpx;
	}

	.confiass_fd1_2 {
		line-height: 36rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: var(--benbenFontColor0);
		margin: 40rpx 0rpx 0rpx 0rpx;
	}

	.confiass_fd1_1 {
		font-size: 36rpx;
		font-weight: 700;
		color: var(--benbenFontColor0);
		margin: 64rpx 0rpx 0rpx 0rpx;
	}

	.confiass_fd1_0_c1 {
		background: var(--benbenbgColor2);
		width: 118rpx;
		height: 4rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.confiass_fd1_0_c0 {
		background: var(--benbenbgColor7);
		line-height: 36rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: var(--benbenFontColor3);
		border-radius: 50rpx 50rpx 50rpx 50rpx;
		background-size: 100% auto !important;
		padding: 8rpx 16rpx 8rpx 16rpx;
	}

	.confiass_fd1_0 {
		margin: 143rpx 0rpx 0rpx 0rpx;
	}
</style>
